<?php


namespace App\Models\Relations;


use App\Models\RoleUser;

trait UserHasRole
{
    public function administrator()
    {
        return $this->hasMany(RoleUser::class, 'user_id', 'id')
            ->where('role_id', 1);
    }

    /**
     * 添加权限
     *
     * @return mixed
     * @author Bob(bobcoder@qq.com)
     */
    public function addRole()
    {
        return $this->hasMany(RoleUser::class, 'user_id', 'id');
    }
}
